﻿<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../../../assets/docs.css" rel="stylesheet" type="text/css" media="screen" />
<title>MooTools Documentation - Browser/Browser</title>
</head>

<body>
  <div id="docs" class="doc">
    <div class="methods">
      <h4 class="menu-item"><a href="#Browser">Browser</a></h4>
			<div class="menu-item"><a href="#Browser:Browser-Features">Browser.Features</a></div>
			<div class="menu-item"><a href="#Browser:Browser-name">Browser.name</a></div>
			<div class="menu-item"><a href="#Browser:Browser-version">Browser.version</a></div>
			<div class="menu-item"><a href="#Browser:Browser-Platform">Browser.Platform</a></div>
			<div class="menu-item"><a href="#Browser:Browser-Plugins">Browser.Plugins</a></div>
			<div class="menu-item"><a href="#Browser:Browser-Request">Browser.Request</a></div>
			<div class="menu-item"><a href="#Browser:Browser-exec">Browser.exec</a></div>
			<div class="menu-item"><a href="#Deprecated">Deprecated</a></div>
    </div>
    <div class="l-border r-border span-15 content">
				<h1 id="Browser"><a href="#Browser">Object: Browser</a></h1>

<p class="description">Some browser properties are attached to the Browser Object for browser and platform detection.</p>

<h2 id="Browser:Browser-Features"><a href="#Browser:Browser-Features">Browser.Features</a></h2>

<ul class="description">
<li>Browser.Features.xpath - (<em>boolean</em>) True if the browser supports DOM queries using XPath.</li>
<li>Browser.Features.air - (<em>boolean</em>)  True if the browser supports AIR.</li>
<li>Browser.Features.query - (<em>boolean</em>) True if the browser supports querySelectorAll.</li>
<li>Browser.Features.json - (<em>boolean</em>) True if the browser has a native JSON object.</li>
<li>Browser.Features.xhr - (<em>boolean</em>) True if the browser supports native XMLHTTP object.</li>
</ul>
<h2 id="Browser:Browser-name"><a href="#Browser:Browser-name">Browser.name</a></h2>

<p class="description">'Browser.name' reports the name of the Browser as string, identical to the property names of the following Boolean values:</p>

<ul>
<li>Browser.ie - (<em>boolean</em>) True if the current browser is Internet Explorer.</li>
<li>Browser.firefox - (<em>boolean</em>) True if the current browser is Firefox.</li>
<li>Browser.safari - (<em>boolean</em>) True if the current browser is Safari.</li>
<li>Browser.chrome - (<em>boolean</em>) True if the current browser is Chrome.</li>
<li>Browser.opera - (<em>boolean</em>) True if the current browser is Opera.</li>
</ul>
<p>In addition to one of the above properties a second property consisting of the name and the major version is provided ('Browser.ie6', 'Browser.chrome15', ...).</p>

<p>If 'Browser.chrome' is True, all other possible properties, like 'Browser.firefox', 'Browser.ie', ... , will be <code>undefined</code>.</p>

<h3>Example:</h3>

<pre class="javascript"><span class="kw3">alert</span><span class="br0">(</span>Browser.<span class="kw3">name</span><span class="br0">)</span>; <span class="co1">// Alerts "ie" in Internet Explorer, "firefox" in Mozilla Firefox, "chrome" in Google Chrome, "safari" or "opera".</span>
&nbsp;
<span class="kw1">if</span> <span class="br0">(</span>Browser.<span class="me1">ie</span><span class="br0">)</span><span class="br0">{</span>
    <span class="co1">// This code will only run in IE</span>
<span class="br0">}</span>
&nbsp;
<span class="kw1">if</span> <span class="br0">(</span>Browser.<span class="me1">firefox2</span><span class="br0">)</span><span class="br0">{</span>
    <span class="co1">// This code will only run in Firefox 2</span>
<span class="br0">}</span>
&nbsp;
<span class="kw1">if</span> <span class="br0">(</span>Browser.<span class="me1">ie6</span> || Browser.<span class="me1">ie7</span><span class="br0">)</span><span class="br0">{</span>
    <span class="co1">// Please upgrade your browser</span>
<span class="br0">}</span>
</pre>

<p>If an IE document is set to backwards compatibility mode using the X-UA-Compatible header, then the Browser object is treated as if the earlier version of the browser is running.</p>

<h2 id="Browser:Browser-version"><a href="#Browser:Browser-version">Browser.version</a></h2>

<p class="description">'Browser.version' reports the version of the Browser as number.</p>

<h3>Example:</h3>

<pre class="javascript"><span class="kw3">alert</span><span class="br0">(</span>Browser.<span class="me1">version</span><span class="br0">)</span>; <span class="co1">// Alerts '3.6' in FireFox 3.6.13</span>
</pre>

<h2 id="Browser:Browser-Platform"><a href="#Browser:Browser-Platform">Browser.Platform</a></h2>

<ul class="description">
<li>Browser.Platform.mac - (<em>boolean</em>) True if the platform is Mac.</li>
<li>Browser.Platform.win - (<em>boolean</em>) True if the platform is Windows.</li>
<li>Browser.Platform.linux - (<em>boolean</em>) True if the platform is Linux.</li>
<li>Browser.Platform.ios - (<em>boolean</em>) True if the platform is iOS.</li>
<li>Browser.Platform.android - (<em>boolean</em>) True if the platform is Android</li>
<li>Browser.Platform.webos - (<em>boolean</em>) True if the platform is WebOS</li>
<li>Browser.Platform.other - (<em>boolean</em>) True if the platform is neither Mac, Windows, Linux, Android, WebOS nor iOS.</li>
<li>Browser.Platform.name - (<em>string</em>) The name of the platform.</li>
</ul>
<h2 id="Browser:Browser-Plugins"><a href="#Browser:Browser-Plugins">Browser.Plugins</a></h2>

<ul class="description">
<li>Browser.Plugins.Flash - (<em>object</em>) - An object with properties corresponding to the <code>version</code> and <code>build</code> number of the installed Flash plugin. Note: if flash is not installed, both <code>Browser.Plugins.Flash.version</code> and <code>Browser.Plugins.Flash.build</code> will return zero.</li>
<li>Browser.Plugins.Flash.version - (<em>number</em>) The major version of the flash plugin installed.</li>
<li>Browser.Plugins.Flash.build - (<em>number</em>) The build version of the flash plugin installed.</li>
</ul>
<h2 id="Browser:Browser-Request"><a href="#Browser:Browser-Request">Browser.Request</a></h2>

<ul class="description">
<li>Browser.Request - (<em>object</em>) The XMLHTTP object or equivalent.</li>
</ul>
<h2 id="Browser:Browser-exec"><a href="#Browser:Browser-exec">Browser.exec</a></h2>

<p class="description">Executes the passed in string in the browser context.</p>

<h3>Example:</h3>

<pre class="javascript">Browser.<span class="me1">exec</span><span class="br0">(</span><span class="st0">'alert("Moo!");'</span><span class="br0">)</span>;
</pre>

<h2 id="Deprecated"><a href="#Deprecated">Deprecated</a></h2>

<p class="description">The <em>Browser.Engine</em> object is deprecated since MooTools 1.3.</p>

<h3>Engine:</h3>

<ul>
<li>Browser.Engine.trident - (<em>boolean</em>) True if the current browser uses the trident engine (e.g. Internet Explorer).</li>
<li>Browser.Engine.gecko - (<em>boolean</em>) True if the current browser uses the gecko engine (e.g. Firefox, or any Mozilla Browser).</li>
<li>Browser.Engine.webkit - (<em>boolean</em>) True if the current browser uses the webkit engine (e.g. Safari, Google Chrome, Konqueror).</li>
<li>Browser.Engine.presto - (<em>boolean</em>) True if the current browser uses the presto engine (e.g. Opera 9).</li>
<li>Browser.Engine.name - (<em>string</em>) The name of the engine.</li>
<li>Browser.Engine.version - (<em>number</em>) The version of the engine. (e.g. 950)</li>
</ul>
    </div>
  </div>
<script type="text/javascript" src="../../../assets/mootools-core-1.3.js"></script>
<script type="text/javascript" src="../../../assets/mootools-more-smoothscroll.js"></script>
<script type="text/javascript" src="../../../assets/doc-assist.js"></script>
</body>
</html>
